package com.boesch.electroOffice.business.businessObject;

import java.util.List;

import com.boesch.electroOffice.business.common.BusinessException;
import com.boesch.electroOffice.dataaccess.common.IllegalDataAccessException;
import com.boesch.electroOffice.model.messerli.Customer;
import com.liferay.portal.model.User;

/**
 * This interface allocates all methods for CustomerBusinessObject.
 * The methods are only called by the application layer.
 * If there is an error on executing the method, a illegalBusinessObjectException will be thrown.
 * 
 * @author Ralph Koster
 *
 */
public interface CustomerBusinessObject {

	/**
	 * Reads a customer by customerId from dataaccess.
	 * 
	 * @param int customerId
	 * @return CustomerMesserli customer
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public Customer readCustomerByCustomerId(int customerId) throws IllegalDataAccessException, BusinessException;
	
	
	/**
	 * Reads a customer by email address from dataaccess.
	 * 
	 * @param String emailAddress
	 * @return CustomerMesserli customer
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public Customer readCustomerByCustomerEmailAddress(String emailAddress) throws IllegalDataAccessException, BusinessException;
	
	
	/**
	 * Reads a list of customers by firstname and lastname from dataaccess.
	 * 
	 * @param String firstname
	 * @param String lastname
	 * @return List<CustomerMesserli> customers
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public List<Customer> readCustomersByNameAndFirstname(String firstname, String lastname) throws IllegalDataAccessException, BusinessException;
	
	
	/**
	 * Reads all customers from dataaccess.
	 * 
	 * @return List<CustomerMesserli> customers
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public List<Customer> readAllCustomers() throws IllegalDataAccessException, BusinessException;
	
	
	/**
	 * Reads all salutations for customers from dataaccess.
	 * 
	 * @return List<String> salutations
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public List<String> readAllSalutations() throws IllegalDataAccessException, BusinessException;
	
	
	/**
	 * Saves a new customer
	 * 
	 * @param Customer customer
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public String saveCustomer(Customer customer, User currentUser) 
			throws IllegalDataAccessException, BusinessException;
	
	
	
	/**
	 * Updates a customer
	 * 
	 * @param Customer customer
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public String updateCustomer(Customer customer, User currentUser) 
			throws IllegalDataAccessException, BusinessException;
}
